/**
 * @file 后台接口文件
 *
 * @author fanxingguang
 * 2016-10-31
 */
'use strict';

let util = {

    /**
     * 解析url
     *
     * @param  {string} url 地址
     * @return {Object} 返回hostname 和 path
     */
    parseUrl(url) {
        let matchedArray = url.match(/(https?:\/\/)?(.*?)\//);
        let hostname = matchedArray[2];
        let path = url.substring(url.indexOf(hostname) + hostname.length);
        return {hostname, path};
    }
};

module.exports = util;
